// ex8_7_8.cpp
#include <iostream>

struct box
{
	char maker[40];
	float height;
	float width;
	float length;
	float volume;
};
template<class T> T max_T(T &a, T &b);
/*{
	return a > b ? a : b;
}*/

template<>  box max_T<>(box &a, box &b)
{
	a.volume = a.height * a.width * a.length;
	b.volume = b.height * b.width * b.length;

	return (a.volume > b.volume) ? a : b;
}

void display(struct box &b)
{
	using std::cout;
	cout << b.maker << " "
		 << b.height << " "
		 << b.width << " "
		 << b.volume << "\n";
}

int main(void)
{
	box b1 = {"box1", 5.0, 3.0, 4.0, 60.0};
	box b2 = {"box2", 10.0, 6.0, 8.0, 480.0};
	display(b1);
	display(b2);
	box b3 = max_T(b1, b2);
	std::cout << "the max one is:\n";
	display(b3);
}
